#include <iostream>
#include <algorithm>
using namespace std;


struct mem{
	int index,time;
};


bool cmp(mem a,mem b){
	return (a.time==b.time?a.index<b.index:a.time<b.time);
}


int main(){
	int n;
	double ans=0;
	cin>>n;
	mem t[n];
	for(int i=0;i<n;i++){
		cin>>t[i].time;
		t[i].index = i;
	}
	sort(t,t+n,cmp);
	for(int i=0;i<n;i++){
		cout<<t[i].index+1<<" ";
		ans += (t[i].time*(n-i-1));
	}
	cout<<endl;
	printf("%.2f",(ans/n));
	return 0;
} 
